package com.internship.javawebinternship.repository;

import com.internship.javawebinternship.entity.Notification;
import com.internship.javawebinternship.entity.TutorClasses;
import org.springframework.data.jpa.repository.JpaRepository;
import org.springframework.data.jpa.repository.Modifying;
import org.springframework.data.jpa.repository.Query;
import org.springframework.transaction.annotation.Transactional;

import java.util.List;

public interface TutorClassesRepository extends JpaRepository<TutorClasses, String> {

    public List<TutorClasses> findByEmpno(String no);

    @Transactional(rollbackFor = Exception.class)
    @Modifying
    public int deleteByEmpno(String no);

    @Transactional(rollbackFor = Exception.class)
    @Modifying
    @Query(value = "INSERT INTO covid19.tutor_classes (empNo, college, profession, grade, classes) VALUES (?1,?2,?3,?4,?5)", nativeQuery = true)
    public void UpdateTutorInfo(String no, String college, String profession, String grade, String classes);

}
